#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
import time
#获取当前Unix时间戳
print(time.time()) #time.time-当前时间戳
#获取当前时间-时间元祖
#print(time.localtime(time.time())) #time-localtime-当前时间元祖
print(time.localtime()) #time-localtime-当前时间元祖

#格式转换函数
#asctime
print(time.asctime(time.localtime(time.time()))) #time-asctime-当前时间元祖默认格式化
#strftime
mytime = time.strftime("%Y-%m-%d:%H:%M:%S",time.localtime())
#print(time.strftime("%Y-%m-%d:%H:%M:%S",time.localtime()))
print(mytime)

#格式化时间转换为时间戳 time.strptime
print(time.mktime(time.strptime(mytime,"%Y-%m-%d:%H:%M:%S")))
